package com.education.wisdom.service.impl;

import com.education.common.utils.Convert;
import com.education.wisdom.mapper.PersonalCatalogMapper;
import com.education.wisdom.pojo.PersonalCatalog;
import com.education.wisdom.service.IPersonalCatalogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * 个人资源目录 服务层实现
 *
 * @author ruoyi
 * @date 2019-06-05
 */
@Service
public class PersonalCatalogServiceImpl implements IPersonalCatalogService {
    @Autowired
    private PersonalCatalogMapper personalCatalogMapper;

    /**
     * 查询个人资源目录信息
     *
     * @param catalogCode 个人资源目录ID
     * @return 个人资源目录信息
     */
    @Override
    public PersonalCatalog selectPersonalCatalogById(Integer catalogId) {
        return personalCatalogMapper.selectPersonalCatalogById(catalogId);
    }

    /**
     * 查询个人资源目录列表
     *
     * @param personalCatalog 个人资源目录信息
     * @return 个人资源目录集合
     */
    @Override
    public List<PersonalCatalog> selectPersonalCatalogList(PersonalCatalog personalCatalog) {
        return personalCatalogMapper.selectPersonalCatalogList(personalCatalog);
    }

    /**
     * 新增个人资源目录
     *
     * @param personalCatalog 个人资源目录信息
     * @return 结果
     */
    @Override
    public int insertPersonalCatalog(PersonalCatalog personalCatalog) {
        personalCatalog.setCreateTime(new Date());
        return personalCatalogMapper.insertPersonalCatalog(personalCatalog);
    }

    /**
     * 修改个人资源目录
     *
     * @param personalCatalog 个人资源目录信息
     * @return 结果
     */
    @Override
    public int updatePersonalCatalog(PersonalCatalog personalCatalog) {
        return personalCatalogMapper.updatePersonalCatalog(personalCatalog);
    }

    /**
     * 删除个人资源目录对象
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deletePersonalCatalogByIds(String ids) {
        return personalCatalogMapper.deletePersonalCatalogByIds(Convert.toStrArray(ids));
    }

}
